import { pubRequire } from '@utils/public'
const baseUrl = '/notices'
// 获取列表
export function getSearchList(params, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, params, callBack, errBack)
}
// 提交消息
export function submitRequestAPI(id, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/submit`, '', callBack, errBack)
}
// 删除通知
export function deleteRequestAPI(id, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${id}`, '', callBack, errBack)
}
// 获取通知详情
export function getNoticeDetailAPI(id, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, '', callBack, errBack)
}
// 新增/编辑通知
export function addEditRequestAPI(type, id = '', params, callBack, errBack) {
  let requestType = ''
  let url = ''
  if (type === 'add') {
    requestType = 'post'
    url = `${baseUrl}`
  } else if (type === 'edit') {
    requestType = 'put'
    url = `${baseUrl}/${id}`
  }
  return pubRequire(requestType, url, params, callBack, errBack)
}
